package nuc.edu.cn;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
public class testThreadLocalSetAndGet {

    @Test
    void getandset(){
        ThreadLocal t1 = new ThreadLocal();
        new Thread(()->{
            t1.set("wjj");
            System.out.println(Thread.currentThread().getName()+":"+t1.get());
        },"红色").start();

        new Thread(()->{
            t1.set("sry");
            System.out.println(Thread.currentThread().getName()+":"+t1.get());
        },"蓝色").start();
    }
}
